//
//  BookmarksWindow.m
//  Communique
//
//  Created by Thomas on 20/03/2009.
//  Copyright 2009 Delete Ltd. All rights reserved.
//

#import "BookmarksWindow.h"
#import "Tunnel.h"

@implementation BookmarksWindow

- (void) awakeFromNib { 
	[tunnelsTable setTarget:self];
	[tunnelsTable setDoubleAction:@selector(editTunnel:)]; 
	NSLog(@"awake %@", self);
} 

- (IBAction)addTunnel:(id)sender {
	[NSApp beginSheet:configureSheet modalForWindow:self
        modalDelegate:self didEndSelector:NULL contextInfo:nil];
	
	Tunnel* t = [[Tunnel alloc] init];
	
	[localTunnels add:t];
	
	NSLog(@"localTunnels %@", localTunnels);
}

- (IBAction)editTunnel:(id)sender {
	[NSApp beginSheet:configureSheet modalForWindow:self
        modalDelegate:self didEndSelector:NULL contextInfo:nil];	
}

- (IBAction)deleteTunnel:(id)sender {
	NSLog(@"localTunnels %@", localTunnels);
	
	[localTunnels remove:self];	
}

- (IBAction)saveTunnel:(id)sender {
	[configureSheet orderOut:nil];
    [NSApp endSheet:configureSheet];
}

- (IBAction)cancelTunnel:(id)sender {
	[configureSheet orderOut:nil];
    [NSApp endSheet:configureSheet];
}

@end
